package 数据结构;
 
    /*
  * 测试用例
7
2 5 8 5 3 5 0
6
5
     */
    
import java.util.Scanner;

class ListNode {
    int val;
    ListNode next = null;

    ListNode(int val) {
        this.val = val;
    }
}


public class 键盘输入实现链表实例 {
    public static ListNode FindKthToTail(ListNode pHead,int n, int k){
        int index=n-k+1;
        int count=1;
        ListNode walkNode=pHead;
        while(walkNode!=null&&count<index){
            count++;
            walkNode=walkNode.next;
        }
        return walkNode;
    }
    public static ListNode init(){
        Scanner scan=new Scanner(System.in);
        String[] array=scan.nextLine().split(" ");
        ListNode pHead=new ListNode(Integer.parseInt(array[0]));
        ListNode walkNode=pHead;
        for(int i=1;i<array.length;i++){
            ListNode newNode=new ListNode(Integer.parseInt(array[i]));
            walkNode.next=newNode;
            walkNode=newNode;
        }
        return pHead;
    }
    public static void main(String[]args){
        Scanner scan=new Scanner(System.in); 
        int n=scan.nextInt();    
        ListNode pHead=init();
        int k=scan.nextInt();
        System.out.print(FindKthToTail(pHead,n,k).val);
    }
}